import { _decorator, Component, Node } from 'cc';
import { EnemyState } from './EnemyState';
import { Enemy } from './Enemy';
import { EnemyStateMachine } from './EnemyStateMachine';
const { ccclass, property } = _decorator;

@ccclass('EnemyIdleState')
export class EnemyIdleState extends EnemyState {
    constructor(_enemy: Enemy, _stateMachine: EnemyStateMachine) {
        super(_enemy, _stateMachine);
    }

    override enter(): void {
        super.enter();
        this.enemy.playAnimation("daiji", true);
    }
    override update(dt: number): void {
        super.update(dt);

        if (this.enemy.isPlayerInDetectionRange()) {
            this.stateMachine.changeState(this.enemy.moveState);
        }
    }
    override exit(): void {
        super.exit();
    }
}


